﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BSCMFF.Core.DataAccessLayer;

namespace BSCMFF.Web.UserControls.Details
{
    public partial class SurveyDetails : System.Web.UI.UserControl
    {
        private Survey_Form _survey;
        public Survey_Form Survey
        {
            get
            {
                //if (_survey == null)
                //{
                //    int tempID = 0;
                //    Int32.TryParse(HiddenFieldID.Value, out tempID);
                //    _survey.ID = tempID;
                //    _survey.Description = RadTextBoxDescription.Text;
                //    //_survey.Target= ??
                //}
                return _survey;
                
            }
            set
            {
                _survey = value;
            }
        }

        public bool IsEditMode { get; set; }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !IsEditMode)
            {
                foreach (Control c in this.Controls)
                {
                    if (c.GetType().Name == "RadTextBox")
                    {
                        c.Visible = false;
                        Label l = (Label)this.FindControl(c.ID.Replace("RadTextBox", "LabelCurrent"));
                        l.Visible = true;
                    }
                    if (c.GetType().Name == "RadNumericTextBox")
                    {
                        c.Visible = false;
                        Label l = (Label)this.FindControl(c.ID.Replace("RadNumericTextBox", "LabelCurrent"));
                        l.Visible = true;
                    }
                }
            }

        }
    }
}